﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using YourWorldServer;
using GreenWorldWinService;

namespace TcpServer
{
    public class GreenWorldServer
    {
        //private static string WebServicesLocation;

        //private Thread runningThread;
        //private SocketServer socketServer = null;
        //private PolicyServer policyServer = null;

        //public GreenWorldServer( string webLocation )
        //{
        //    WebServicesLocation = webLocation;
        //}

        //public void Start()
        //{
        //    this.runningThread = new Thread( new ThreadStart( this.ThreadRun ) );
        //    this.runningThread.Start();
        //}

        //public void Stop()
        //{
        //    if ( this.runningThread != null )
        //        this.runningThread.Abort();
        //}

        //private void ThreadRun()
        //{
        //    try
        //    {
        //        this.policyServer = new PolicyServer();
        //        this.policyServer.StartPolicyServer();

        //        this.socketServer = new SocketServer( WebServicesLocation );
        //        this.socketServer.StartSocketServer();

        //        //while ( true )
        //        //{
        //        //    ;
        //        //}

        //        //this.policyServer.StopPolicyServer();
        //        //this.socketServer.StopSocketServer();
        //    }
        //    catch ( Exception e )
        //    {
        //        // Catch ThreadAbortEx and stop the sockets:
        //        if ( this.policyServer != null )
        //            this.policyServer.StopPolicyServer();

        //        if ( this.socketServer != null )
        //            this.socketServer.StopSocketServer();

        //        if ( e is ThreadAbortException == false )
        //            Log.Instance.WriteException( e );
        //    }
        //}
    }
}
